package com.sfac.javaSpringBoot.modules.common.controller;

import com.sfac.javaSpringBoot.modules.common.entity.Result;
import com.sfac.javaSpringBoot.modules.common.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.sql.ResultSet;

@RestController
@RequestMapping("/api")
public class ImageController {

    @Autowired
    private ImageService imageService;

    /**
     * 127.0.0.1/api/image/big-image ---- post
     */ 
    @PostMapping(value = "/image/{imageTypeName}", consumes = "multipart/form-data")
    public Result<String> uploadImage(@RequestParam MultipartFile image,
                                      @PathVariable String imageTypeName) {
        return imageService.uploadImage(image, imageTypeName);
    }
}